<template>
  <view class="category">
    <navigator
      hover-class="none"
      class="category-item"
      url="/pages/cart/cart"
      v-for="item in list"
      :key="item.id"
      @tap="goCart"
    >
      <image class="icon" :src="item.icon" />
      <text class="text">{{ item.name }}</text>
    </navigator>
  </view>
</template>

<script setup lang="ts">
import type { categoryItem } from '@/types/home';
import { toRefs } from 'vue';

const props = defineProps<{
  list: categoryItem[];
}>();
const { list } = toRefs(props);
// 页面跳转
const goCart = () => {
  uni.switchTab({ url: '/pages/cart/cart' });
};
</script>
<style scoped lang="scss">
@import './styles/categorypanel.scss';
</style>
